# 排列组合

from itertools import permutations

items = ['a', 'b', 'c']
for p in permutations(items):
    print(p)

print('\n=================================\n')

# 指定长度的排列
for p in permutations(items, 2):
    print(p)

print('\n=================================\n')

from itertools import combinations
for c in combinations(items, 3):
    print(c)

print('\n=================================\n')

for c in combinations(items, 2):
    print(c)

print('\n=================================\n')

# 元素可重复
from itertools import combinations_with_replacement
for c in combinations_with_replacement(items, 3):
    print(c)
